import React, { useEffect, useState } from 'react';
import { Tabs, Form, Select, Input, DatePicker, Button, Table } from 'antd';
import * as service from '../../../../api/salary.js'
import * as salary from '../../../../api/requestsalary.js'
import { useNavigate } from 'react-router-dom';
import '../Salary/AddProject.scss'

function AddProject(props: any) {
    var [project, setProject] = useState([])
    var navigate=useNavigate()
    useEffect(() => { //核对算薪人员和薪资核算列表
        // salary.salary_project().then((res) => {
        //     console.log(res);
        //     // setProject(res.data.data)
        // })
        // salary.salary_group({}).then((res: any) => {
        //     console.log(res);
        //     setSalarygroup(res.data)
        // })
    }, [])
    const onFinish = async(values: any) => { //添加薪资项目
        // console.log('Success:', values);
        // var res=await salary.addSar(values)
        // console.log(res);
        navigate('/index/moneys/salary/project')
    };
    var onCancel = () => { }
    return (
        <div className='addproject'>
            <div className='addproject-one'>
                <div className='addproject-title-left'></div>
                <h4 className='addproject-title'>新增自定义薪资项目</h4>
            </div>
            <div className='addproject-two'>
                <Form
                    labelCol={{ span: 6 }}
                    wrapperCol={{ span: 18 }}
                    layout="horizontal"
                    onFinish={onFinish}
                    style={{ maxWidth: 1000 }}
                >
                    <Form.Item label="项目类型" name=''>
                        <Select placeholder='请选择'
                            options={[
                                { value: "固定工资", label: "固定工资" },
                                { value: "考勤", label: "考勤" },
                                { value: "绩效", label: "绩效" },
                                { value: "社保公积金", label: "社保公积金" }
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="进位规则" name=''>
                        <Select placeholder='请选择'
                            options={[
                                { value: "原始数据", label: "原始数据" },
                                { value: "四舍五入", label: "四舍五入" },
                                { value: "向上舍入数字", label: "向上舍入数字" },
                                { value: "向下舍入数字", label: "向下舍入数字" },
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="保留几位小数" name=''>
                        <Select placeholder='请选择'
                            options={[
                                { value: "0", label: "0" },
                                { value: "1", label: "1" },
                                { value: "2", label: "2" },
                                { value: "3", label: "3" },
                                { value: "4", label: "4" }
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="描述" name=''>
                        <Select placeholder='请选择'
                            options={[
                                { value: "劳动合同中约定的标准工资", label: "劳动合同中约定的标准工资" }
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="项目来源" name=''>
                        <Select placeholder='请选择'
                            options={[
                                { value: "系统", label: "系统" },
                                { value: "个人", label: "个人" }
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="计算公式" name=''>
                        <Select placeholder='请选择'
                            options={[
                                { value: "从【薪资档案-基本工资】自动提取数据", label: "从【薪资档案-基本工资】自动提取数据" }
                            ]}
                        />
                    </Form.Item>
                    <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
                        <Button type="primary" htmlType="submit">保存</Button>
                        <Button htmlType="button" onClick={() => { onCancel() }}>取消</Button>
                    </Form.Item>
                </Form>
            </div>
        </div>
    );
}

export default AddProject;